| Sub | Function | Virtually every Win32 API function returns a Long value and should be declared as a function. You may declare the statement as a Sub if you don't need to refer to the return value. If you declare the statement as a Function, be sure to specify a return value of the correct type. The default return value (variant) will probably cause an error or memory exception. |
name | The name by which the function will be called in Visual Basic. Read the notes on the Alias term for more information. This name must follow the same naming rules as any Visual Basic function. For example: the name may not match another name in the same module (regardless of case). |
Lib | The term that follows this keyword is the librarythe name of the DLL that contains the function. |
"libname" | The name of the DLL in quotes. If you are specifying one of the three major DLLs (Kernel32, User32, or GDI32), you need not include an extension. Otherwise, be sure to include the extension (.dll in most cases). You can include a full pathname here, but in most cases you will just include the DLL name so that your application will be able to find the DLL regardless of where the application is installed. Windows will search for the DLL using the standard search rules for the operating system that you are using. The DLL will typically be placed either in the system directory (typically named \windows\system for Windows95/8 and \Winnt\system32 for NT) or in the same directory as the application. Shared DLLs should be placed in the system directory. |
Alias | If this term is missing, Visual Basic will assume that the "name" term also specifies the name of the function in the DLL. In this approach, note that the function name specified is case-sensitive (it must match the capitalization of the exported function exactly). |
"aliasname" | If specified, this is the name of the exported function in the DLL. This term is case-sensitive. |
[([arglist])] | The function parameters. This will be covered in great detail in tutorials that follow. |